Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

293
Vistas
Passing multiple "key-value" pairs as a parameter to a JS function

I have a date range picker, and I want to pass the two dates (startDate, endDate) to handleFilterChange, which builds an filter object to save in session storage. Currently I try to call the function, giving parameters as two arrays, which obviously doesn't work. Calling the function twice also didn't work.

Is this thing even possible and if, then what would be a correct way to pass these two dates to this function?

handleFilterChange

const handleFilterChange = (value, title) => {
    clearPreviousResults();
    const newFilters = {
        ...filters,
        [title]: value,
    };

    saveFilterValue(newFilters, FILTERS_STORAGE_KEY);
    setFilters(newFilters)

date picker

const handleDateRangeChange = dates => {
    if (!dates || dates.length <= 1) {
        return;
    }
    handleFilterChange( ["startDate", "endDate"], [dates[0], dates[1]] );
    };
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I am assuming you are trying to save an object in the LocalStorage or session. I would rather send the whole dates array to handleFilterChange function.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda